package tr.gov.tubitak.bilgem.esya.certselector;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.MessageFormat;
import java.util.ResourceBundle;

/**
 <b>Author</b>    : zeldal.ozdemir <br/>
 <b>Project</b>   : MA3   <br/>
 <b>Copyright</b> : TUBITAK Copyright (c) 2006-2011 <br/>
 <b>Date</b>: 8/17/11 - 8:29 AM <p/>
 <b>Description</b>: <br/>
 */
public class Bundle {
    private Bundle(){};
    private static final Logger logger = LoggerFactory.getLogger(Bundle.class);
//    static ResourceBundle delegate = getBundle();

    public synchronized static ResourceBundle getBundle() {
        return ResourceBundle.getBundle("tr.gov.tubitak.bilgem.esya.certselector");
    }

    public static String getString(String key) {
        try {

            String value = getBundle().getString(key);
//            System.out.println("Bundle Key-Value:"+key+"-"+value);
            return value;
        } catch (Exception e) {
            logger.error(e.getMessage());
            return "?" + key + "?";
        }
    }
    public static String getString(String key, String... params){
        return MessageFormat.format(getString(key),params);
    }

    /*public static ResourceBundle getBundle(String s) {
        return null;
    } */
}
